﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Flower : Base_
{

    /// <summary>
    /// 放置的初始化
    /// </summary>
    public override void InitForPlace(Grid grid)
    {
        hp = 300;
        currGrid = grid;
        transform.position = grid.wordPoint;
        currGrid.CurrPlantBase = this;
        sprite.sortingOrder = 0;
        InvokeRepeating("WaitCreatSun", 7,7); 
    }
    void WaitCreatSun()
    {
        StartCoroutine(ColorChange(0.05f, new Color(1,0.6f,0),0.05f,Ctratsun)); 
    }
 
    void Ctratsun()
    {
        GameObject sun = Instantiate(GameManager.instance.Gameconf.sunprefab, transform.position, Quaternion.identity);
        sun.transform.SetParent(GameObject.Find("SkySun").transform);
        sun.GetComponent<Sun>().JumpAni();
        sun.GetComponent<Sun>().issky = false;
    }
}
